import 'package:f200/common/index.dart';
import 'package:f200/features/cart/presentation/shopping_cart/shopping_cart_screen.dart';
import 'package:f200/features/categroy/presentation/category_screen.dart';
import 'package:f200/features/member/presentation/mine_page/mine_page.dart';
import 'package:f200/pages/home/views/home_view.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

class IndexController extends BaseController {
  final RxInt _currentIndex = 0.obs;
  final List<Widget> _pages = [
    const HomeView(),
    const CategoryScreen(),
    const HomeView(),
    const ShoppingCartScreen(),
    const MinePage(),
  ];

  RxInt get currentIndex => _currentIndex;
  List<Widget> get pages => _pages;
  final PageController pageController = PageController(initialPage: 0);

  void switchPage(int index) {
    currentIndex.value = index;
    pageController.jumpToPage(index);
  }

  @override
  void dispose() {
    logD('IndexController dispose');
    pageController.dispose();
    super.dispose();
  }
}
